cmake_minimum_required(VERSION 3.5)
project(state_monitor)

add_compile_options(-std=c++17)
SET(CMAKE_BUILD_TYPE "Release")

find_package(ament_cmake REQUIRED)
find_package(rclcpp REQUIRED)
find_package(rclpy REQUIRED)
find_package(std_msgs REQUIRED)
find_package(std_srvs REQUIRED)
find_package(agv_msgs REQUIRED)
find_package(agv_srvs REQUIRED)
find_package(realtime_tools REQUIRED)
find_package(diagnostic_msgs REQUIRED) 
find_package(shared_parameters REQUIRED)
#find_package(generate_parameters_header REQUIRED)

find_package(Boost REQUIRED COMPONENTS thread system chrono)

#SET(CMAKE_CXX_FLAGS_DEBUG "$ENV{CXXFLAGS} -O0 -Wall -g -ggdb")
#SET(CMAKE_CXX_FLAGS_RELEASE "$ENV{CXXFLAGS} -O3 -Wall")

include_directories(
  include
  /usr/include/python3.8
)

file(GLOB_RECURSE SRCS 
  src/*.cpp
)

#add_library(event_manager SHARED src/event_manager.cpp)
#target_include_directories(event_manager PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include)

add_executable(monitor  
  ${SRCS}
)

#message(STATUS "Run generate parameters head script")
#generate_parameters_header(${PROJECT_NAME} monitor)

ament_target_dependencies(monitor
  "std_msgs"
  "std_srvs"
  "realtime_tools"
  "agv_msgs"
  "agv_srvs"
  "geometry_msgs"
  "rclpy"
  "rclcpp"
  "shared_parameters"
)

target_link_libraries(monitor
  ${Boost_LIBRARIES}
  jsoncpp 
  yaml-cpp
)

ament_export_dependencies(rclcpp rclpy std_msgs agv_msgs agv_srvs diagnostic_msgs)
ament_package()

install(TARGETS monitor
  RUNTIME DESTINATION lib/${PROJECT_NAME}
)

install(DIRECTORY launch config
  DESTINATION share/${PROJECT_NAME}
)

install(TARGETS monitor
  ARCHIVE DESTINATION lib
  LIBRARY DESTINATION lib
  RUNTIME DESTINATION bin
)


